-
Notifications
You must be signed in to change notification settings - Fork 593
proto: initial protobuf for config #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👍 We should probably create a branch to flesh this out and see if it meets all our requirements. |
|
fair. I'm still working through it, but figured to get the conversation On Fri, Sep 11, 2015 at 1:13 PM, Mrunal Patel [email protected]
|
proto/config.proto
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to consider with required fields is that it might be almost impossible to make it optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you saying to start with preferring optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
|
Ya, we could do a branch on the repo to figure this out if that makes it easier. |
|
@vishh updated the field rules |
|
So, I've stubbed out the [platform dependent] |
proto/config.proto
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to give us per-platform namespacing inside User? E.g.
"user": {
"linux": {
"uid": 0,
"gid": 0,
}
}That's the pattern we use in other sections of the existing config (e.g. for linux.capabilities), but it seems excessive here. However, the benefits of a protobuf-based schema may warrant a few warts in the associated JSON structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not namespacing, just platform dependent user attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Fri, Sep 11, 2015 at 12:58:22PM -0700, Vincent Batts wrote:
- // LinuxUserFields are to be used when Type is LINUX
- optional linuxUserFields LinuxUserFields = 2;
not namespacing, just platform dependent user attributes.
Generated Go (from b5433ce) has:
// User specifies user information for the process.
type User struct {
// Type so that receivers of this message can switch for the fields expected
Type *PlatformType protobuf:"varint,1,opt,enum=oci.PlatformType,def=1" json:"Type,omitempty"
// LinuxUserFields are to be used when Type is LINUX
LinuxUserFields *LinuxUserFields protobuf:"bytes,2,opt" json:"LinuxUserFields,omitempty"
XXX_unrecognized []byte json:"-"
}
Which looks like it's going to lead to a an explicit “LinuxUserFields”
level to me. And again, I'm not against a bit of wordiness in support
of spec that can autogenerate bindings in a number of languages, but
that explicit platform level is not how we handle user entries now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any primitive might be useful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vishh ah that sounds like what I'm looking for, but that's in proto3. I'm dealing with proto2 :-\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm playing with permutations of extensions right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wking general adoption
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Mon, Sep 14, 2015 at 10:06:25AM -0700, Vincent Batts wrote:
@wking general adoption
Does protobuf-version adoption really matter? If we're just using it
for code-generation, it seems like you'd only need a few folks running
the protobuf-to-$X translators. Everyone else can just consume that
generated code, without interacting with protobuf at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Mon, Sep 14, 2015 at 12:04:48PM -0700, Vincent Batts wrote:
I don't intend on commiting the generated code.
No need to commit it, just ship it with release tarballs.
|
Alrighty, y'all. A couple of concessions, but is pretty much lined up for an initial review. |
proto/Makefile
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
‘defualt’ → ‘default’ ;)
proto/config.proto
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If any of these fields are required to be set, can we explicitly state that in the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. That relationship is a bit cloudied by the required, optional, repeated field rules.
To have a less source based, and more consumable example of structures, this is an initial pass at protobuf structures for the structures in config.go There is some exercise needed in platform specific structures. For the sake of example, the Makefile defaults to outputing golang source, but has a 'c' target (`make c`) for C source as well. Signed-off-by: Vincent Batts <[email protected]>
This User structure does not map to the cleanliness of the current go structure, but will allow the definition to be all in one place, regardless of the host that is doing the compilation. Switching field rules to `optional` for now. Per vish and the docs, https://developers.google.com/protocol-buffers/docs/proto?csw=1#specifying-field-rules "! Required Is Forever" Also add a `make py` and `make all` target. Signed-off-by: Vincent Batts <[email protected]>
There are a couple of concessions, but is pretty much lined up. Signed-off-by: Vincent Batts <[email protected]>
Signed-off-by: Vincent Batts <[email protected]>
Signed-off-by: Vincent Batts <[email protected]>
Signed-off-by: Vincent Batts <[email protected]>
Signed-off-by: Vincent Batts <[email protected]>
Let the user decide the value. opencontainers#179 (comment) Signed-off-by: Vincent Batts <[email protected]>
per opencontainers#179 (comment) Signed-off-by: Vincent Batts <[email protected]>
|
updated for comments. Also, I'll have to close this PR and open another to put these changes against a branch besides master. Not sure where/what we want that branch to be. |
|
@vbatts Maybe just call it protobuf. |
Signed-off-by: Vincent Batts <[email protected]>
|
moving this PR over to #185 |
Let the user decide the value. opencontainers#179 (comment) Signed-off-by: Vincent Batts <[email protected]>
per opencontainers#179 (comment) Signed-off-by: Vincent Batts <[email protected]>
To have a less source based, and more consumable example of structures,
this is an initial pass at protobuf structures for the structures in config.go
There is some exercise needed in platform specific structures.
For the sake of example, the Makefile defaults to outputing golang
source, but has a 'c' target (
make c) for C source as well.Signed-off-by: Vincent Batts [email protected]